#region Usings

using System.Linq;
using KanbanBoard.Server.Command.DomainModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NHibernate.Cfg;

#endregion

namespace KanbanBoard.Tests.Server.Command.Infrastructure.DataAccess {
    [TestClass]
    public class TaskBoardMappingTests {
        [TestMethod]
        public void GetTaskBoards() {
            var configuration = new Configuration().Configure();

            configuration.AddAssembly("KanbanBoard.Server.Command.Infrastructure");

            var sessionFactory = configuration.BuildSessionFactory();
            var session = sessionFactory.OpenSession();
            var transaction = session.BeginTransaction();

            var query = session.CreateQuery("from TaskBoard");

            var taskBoard = query.Enumerable<TaskBoard>().Single();
            taskBoard.CreateNewTask();

            transaction.Commit();
            session.Close();
        }
    }
}

